using System.ComponentModel.DataAnnotations.Schema;
using System.Data.Entity.ModelConfiguration;using Maxleaf.EDI.Domain.K3;

namespace Maxleaf.EDI.DataAccess.K3
{
    public class PortalMap : EntityTypeConfiguration<Portal>
    {
        public PortalMap()
        {
            // Primary Key
            this.HasKey(t => t.PortalID);

            // Properties
            this.Property(t => t.PortalName)
                .IsRequired()
                .HasMaxLength(128);

            this.Property(t => t.LogoFile)
                .HasMaxLength(50);

            this.Property(t => t.FooterText)
                .HasMaxLength(100);

            this.Property(t => t.Currency)
                .IsFixedLength()
                .HasMaxLength(3);

            this.Property(t => t.Description)
                .HasMaxLength(500);

            this.Property(t => t.KeyWords)
                .HasMaxLength(500);

            this.Property(t => t.BackgroundFile)
                .HasMaxLength(50);

            this.Property(t => t.PaymentProcessor)
                .HasMaxLength(50);

            this.Property(t => t.ProcessorUserId)
                .HasMaxLength(50);

            this.Property(t => t.ProcessorPassword)
                .HasMaxLength(50);

            this.Property(t => t.DefaultLanguage)
                .IsRequired()
                .HasMaxLength(10);

            this.Property(t => t.HomeDirectory)
                .IsRequired()
                .HasMaxLength(100);

            // Table & Column Mappings
            this.ToTable("Portals");
            this.Property(t => t.PortalID).HasColumnName("PortalID");
            this.Property(t => t.PortalName).HasColumnName("PortalName");
            this.Property(t => t.LogoFile).HasColumnName("LogoFile");
            this.Property(t => t.FooterText).HasColumnName("FooterText");
            this.Property(t => t.ExpiryDate).HasColumnName("ExpiryDate");
            this.Property(t => t.UserRegistration).HasColumnName("UserRegistration");
            this.Property(t => t.BannerAdvertising).HasColumnName("BannerAdvertising");
            this.Property(t => t.AdministratorId).HasColumnName("AdministratorId");
            this.Property(t => t.Currency).HasColumnName("Currency");
            this.Property(t => t.HostFee).HasColumnName("HostFee");
            this.Property(t => t.HostSpace).HasColumnName("HostSpace");
            this.Property(t => t.AdministratorRoleId).HasColumnName("AdministratorRoleId");
            this.Property(t => t.RegisteredRoleId).HasColumnName("RegisteredRoleId");
            this.Property(t => t.Description).HasColumnName("Description");
            this.Property(t => t.KeyWords).HasColumnName("KeyWords");
            this.Property(t => t.BackgroundFile).HasColumnName("BackgroundFile");
            this.Property(t => t.GUID).HasColumnName("GUID");
            this.Property(t => t.PaymentProcessor).HasColumnName("PaymentProcessor");
            this.Property(t => t.ProcessorUserId).HasColumnName("ProcessorUserId");
            this.Property(t => t.ProcessorPassword).HasColumnName("ProcessorPassword");
            this.Property(t => t.SiteLogHistory).HasColumnName("SiteLogHistory");
            this.Property(t => t.HomeTabId).HasColumnName("HomeTabId");
            this.Property(t => t.LoginTabId).HasColumnName("LoginTabId");
            this.Property(t => t.UserTabId).HasColumnName("UserTabId");
            this.Property(t => t.DefaultLanguage).HasColumnName("DefaultLanguage");
            this.Property(t => t.TimezoneOffset).HasColumnName("TimezoneOffset");
            this.Property(t => t.AdminTabId).HasColumnName("AdminTabId");
            this.Property(t => t.HomeDirectory).HasColumnName("HomeDirectory");
            this.Property(t => t.SplashTabId).HasColumnName("SplashTabId");
            this.Property(t => t.PageQuota).HasColumnName("PageQuota");
            this.Property(t => t.UserQuota).HasColumnName("UserQuota");
        }
    }
}
